<?php
/**
 * Nordic Repository
 * 
 * LICENSE
 * 
 * The new BSD license is applied on this source-file. For further
 * information please visit http://license.nordic-dev.de/newbsd.txt
 * or send an email to andre.moelle@gmail.com.
 */

/**
 * This class is the abstract class for the decorators which can
 * be used in many cases. It implements, as the name implies, the
 * decorator pattern.
 * 
 * @category   Nordic
 * @package    Nordic_Pagebuilder
 * @copyright  2007 Nordic Development
 * @license    http://license.nordic-dev.de/newbsd.txt (New-BSD license)
 * @author     Andre Moelle <andre.moelle@gmail.com>
 * @version    $Id: Decorator.php 3 2007-07-08 09:21:42Z andre.moelle $
 */
abstract class Nordic_Pagebuilder_Decorator
{
	/**
	 * Object which this object wraps.
	 * 
	 * @var Nordic_Pagebuilder_Decorator
	 */
	protected $_decorator = null;
	
	/**
	 * The decorator should accept only an array as argument.
	 * 
	 * @param array $array options
	 * @return void
	 */
	public function __construct (array $array = array())
	{
		
	}
	
	/**
	 * This magical method is used to create the string-representation.
	 * 
	 * It calls the decorator methods and wraps the content of them.
	 * 
	 * @param void
	 * @return string
	 */
	abstract public function __toString ();
	
	/**
	 * Decorates another object.
	 * 
	 * @param Nordic_Pagebuilder_Decorator $decorator decorated object
	 * @return void
	 */
	public function decorate (Nordic_Pagebuilder_Decorator $decorator)
	{
		$this->_decorator = $decorator;
	}
	
	/**
	 * Returns the active decorated object.
	 * 
	 * @param void
	 * @return Nordic_Pagebuilder_Decorator
	 */
	public function getDecorated ()
	{
		return $this->_decorator;
	}
}
?>